<?php

require_once dirname(__FILE__) . "/../../includes/config.php";
require_once PHP_ROOTPATH.'/classes/database.php';

//récupération des types de variations et des localisation des snp enregistrés dans la base de données
header("Content-Type: text/xml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<list>";
 
$id_connect=Database::getInstance();

$query_temp = "SELECT DISTINCT type_variation FROM SNP ORDER BY type_variation";
$res_query = pg_query($id_connect , $query_temp) or die(pg_last_error());
$i=0;
while ($back = pg_fetch_assoc($res_query)) {
	echo $back["type_variation"];
	echo "<item id=\"" . $i . "\" name=\"" . $back["type_variation"] . "\" />";
	$i++;
}

$query_temp2 = "SELECT DISTINCT localisation FROM SNP ORDER BY localisation";
$res_query2 = pg_query($id_connect , $query_temp2) or die(pg_last_error());
$j=200;
while ($back = pg_fetch_assoc($res_query2)) {
	echo $back["localisation"];
	echo "<item id=\"" . $j . "\" name=\"" . $back["localisation"] . "\" />";
	$j++;
}
 
echo "</list>";